package com.baobaotao.dao;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.baobaotao.domain.LoginLog;

@Repository
public class LoginLogDao {

	protected Log logger = LogFactory.getLog(getClass());

	@Autowired //自动注入JdbcTemplate的Bean
	private JdbcTemplate jdbcTemplate;
	
	/**保存新的登陆历史记录对象*/
	public void insertLoginLog(LoginLog loginLog){
		String sql = "INSERT INTO T_LOGIN_LOG(USER_ID,IP,LOGIN_DATETIME) VALUES(?,?,?)";
		Object[] args = {loginLog.getUserId(),loginLog.getIp(),loginLog.getLoginDate()};
		jdbcTemplate.update(sql,args);
	}
}
